The present invention relates to an object-oriented data processing technique, and more particularly to an inheritance solution processing method and apparatus for solving inheritance relationships between classes in an object-oriented data processing system.
One of the advantages of an object-oriented data processing system is a concept of inheritance between classes each constituting a basic programming unit. For example, it is possible for an "automobile class" or "ship class" to inherit, from a "vehicle class", general vehicle attributes (such as manufacturer name, weight, and etc.) and a function (such as calculation of pressure). The term "inheritance" means that a lower class inherits or merges the attribute and function of an upper class. The "vehicle class" having a higher hierarchic concept is called a "superlcass" of the "automobile class" or "ship class", whereas the "automobile class" or "ship class" having a lower hierarchic concept is called a "subclass" of the "vehicle class". In an object-oriented system, such as inheritance function of a class encourages modular design and reuse of programs.
In most of object-oriented systems, a class can have one or more superclasses, and can inherit attributes from them. Such a function is called a multiple inheritance. With multiple inheritance, the following collisions occur between names of attributes and functions to be inherited:
(1) a collision between a class and a superclass, and PA1 (2) a collision between superclasses of a class.
Such a collision is solved in accordance with particular rules provided to each system. For example, for a collision between a class and a superclass, a definition in the class is preferentially used. For a collision between superclasses of a class, a definition in the first superclass within the superclass list is preferentially selected.
Encapsulation and Inheritance in Object-Oriented Programming Languages" by Alan Snyder, 1986 ACM 0-89791-204-7/86/0900-0038 discloses a method for resolving the name conflict such as "Graph-Oriented Solutions", "Linear Solutions" and "Tree Solutions". With these solutions, if a conflict occurs, it is determined which class is adopted or not adopted and which criterion is used for such determination.
An operation of an object-oriented system corresponds to processing a message to be sent to an object. A message generally designates a method name representative of a function (hereinafter also called a method) to be applied to an object (hereinafter also called a receiver, meaning a receptor of a message) and a parameter for the method. In an object-oriented system having an inheritance function, in order to process a message, it is necessary to locate a method designated by the message from a class to which the receiver belongs or from its superclass.
In order to determine the time when a method is located, there is a dynamic inheritance processing scheme by which a search up to a superclass is executed while a message is processed, and a static inheritance processing scheme by which a class merges the attribute and function of its superclass when the class is compiled. According to the dynamic inheritance processing scheme, it is sufficient if a necessary superclass is defined at the time when a message is processed. Therefore, application development has a high flexibility. However, there is a large overhead of class search at the time of message processing. According to the static inheritance processing scheme, it is not necessary to search superclasses at the time of message processing, so that the message can be processed at a high speed. However, it is required that all necessary superclasses must be defined at the time of compiling, resulting in less flexibility.
One method of solving such problems is disclosed, for example, in Japanese Patent Laid-open Publication JP-A 1-240936 "Inheritance Solution Method". According to this method, the inheritance of a designated class is solved in advance at the time of compiling, and at the time of processing a message, the inheritance of a class not solved as yet is solved at that time. According to the prior art method, while preserving a flexibility of application development, an overhead of class search for inheritance solution at the time of processing a message can be made as small as possible at any stage of application development.
The term "inheritance solution" used in the description of the prior art method means that a class on the subclass side merges the definition of a superclass into the internal form of the class.
An object-oriented system has been expected to be applied to the technical field dealing with complex data, typically a CAD/CAM, CASE, and the like. The above-described multiple inheritance function is effective for realizing a model of complicate data presently used in the art.
In realizing the inheritance function, it becomes necessary to provide a flexibility that the function obtained by inheritance is growing as application development progresses, as pointed out by the prior art method.
A basic unit constituting an object-oriented system is a class. In actual application development, it is useful that the executable range of a function obtained by inheritance be as wide as possible to the extent sufficient for the definition contents at the intermediate stage of application development, because the debugging work of a class can be made through local verification. It is therefore necessary to efficiently execute both a partial inheritance processing in accordance with the definition contents at a certain stage of application development and an inheritance re-processing in accordance with the definition of a new class or the updated definition of an old class.
At the intermediate stage of application development, inheritance from a superclass still not defined cannot be allowed. Even if a superclass has been defined. Inheritance may not be allowed depending upon a multiple inheritance collision solution rule specific to a system. For example, if a superclass having a higher priority order is not still defined, the definition contents to be inherited from a superclass having a lower priority order cannot be determined. The reason for this is as follows. Even if the definition contents are inherited from the superclass having a lower priority order and a debugging work and the like are carried out, these operations may be made invalid depending upon the definition contents of the superclass having a higher priority order.
The above problems are related to the contents of inheritance regarding a permission/prohibition of inheritance between a class and its superclass, and are independent from the timing of inheritance processing. The above-described prior art method does not concern this issue.